Remove another implicit time_t conversion.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 16 Aug 2013 06:19:05 +0000 (06:19 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 16 Aug 2013 06:19:05 +0000 (06:19 +0000)
17 files changed:
gpsbabel/cetus.cc
gpsbabel/exif.cc
gpsbabel/garmin_txt.cc
gpsbabel/gdb.cc
gpsbabel/gopal.cc
gpsbabel/gtm.cc
gpsbabel/gtrnctr.cc
gpsbabel/igo8.cc
gpsbabel/interpolate.cc
gpsbabel/itracku.cc
gpsbabel/kml.cc
gpsbabel/lowranceusr.cc
gpsbabel/mtk_logger.cc
gpsbabel/netstumbler.cc
gpsbabel/random.cc
gpsbabel/src/core/datetime.h
gpsbabel/unicsv.cc

index d5d05e3b6056d0a99fc38f827e7194500c73b734..d96e5c393edbf1ec7d70b29f94d52e3659be9916 100644 (file)
@@ -366,7 +366,7 @@ read_waypts(const pdbfile* pdb)
       tm.tm_mon = rec->mon - 1;
       tm.tm_year = be_read16(&rec->year) - 1900;
 
-      wpt_tmp->creation_time = mkgmtime(&tm);
+      wpt_tmp->SetCreationTime(mkgmtime(&tm));
 
     }
 
index d65e94a6e53a48c9ed50eabd4599921951e96bbf..51c48af32891a0a8fecd1996e862b91286549cb3 100644 (file)
@@ -856,9 +856,9 @@ exif_waypt_from_exif_app(exif_app_t* app)
     printf(MYNAME "-GPSTimeStamp =   %s\n", str);
     xfree(str);
 #endif
-    wpt->creation_time = timestamp;
+    wpt->SetCreationTime(timestamp);
   } else {
-    wpt->creation_time = exif_get_exif_time(app);
+    wpt->SetCreationTime(exif_get_exif_time(app));
   }
 
   tag = exif_find_tag(app, EXIF_IFD, EXIF_IFD_TAG_USER_CMT); /* UserComment */
index 922e5eb89b23dc7297cf38c6959091660013de58..10abf14c968c81585f40634b398c5715b333c25f 100644 (file)
@@ -1196,7 +1196,7 @@ parse_waypoint(void)
     case 16: {
       time_t ct;
       parse_date_and_time(str, &ct);
-      wpt->creation_time = ct;
+      wpt->SetCreationTime(ct);
       }
       break;
     case 17: {
@@ -1315,7 +1315,7 @@ parse_track_waypoint(void)
     case 2: {
       time_t ct;
       parse_date_and_time(str, &ct);
-      wpt->creation_time = ct;
+      wpt->SetCreationTime(ct);
       }
       break;
     case 3:
index 9efec606a0930122b2bd22e3eaa708154ee619f2..e44c070d16a1102c854f3074a9615f0222a19a6e 100644 (file)
@@ -698,7 +698,7 @@ read_waypoint(gt_waypt_classes_e* waypt_class_out)
     }
   }
   if (FREAD_C == 1) {
-    res->creation_time = FREAD_i32;
+    res->SetCreationTime(FREAD_i32);
   }
 
   /* VERSION DEPENDENT CODE */
@@ -993,7 +993,7 @@ read_track(void)
       }
     }
     if (FREAD_C == 1) {
-      wpt->creation_time = FREAD_i32;
+      wpt->SetCreationTime(FREAD_i32);
     }
     if (FREAD_C == 1) {
       WAYPT_SET(wpt, depth, FREAD_DBL);
index 3bb16ce7dd8b5a4d4b1bd23a4a0c55f88e6c6105..238817b1206ddb1b6693040c2e16789e38082833 100644 (file)
@@ -234,7 +234,7 @@ gopal_read(void)
         tm.tm_mon=trackdate.tm_mon;
         tm.tm_mday=trackdate.tm_mday;
         // This will probably be overwritten by field 9...if we have 9 fields.
-        wpt->creation_time = tx+((((time_t)tm.tm_hour * 60) + tm.tm_min) * 60) + tm.tm_sec;
+        wpt->SetCreationTime(tx+((((time_t)tm.tm_hour * 60) + tm.tm_min) * 60) + tm.tm_sec);
         wpt->creation_time = wpt->creation_time.addMSecs(millisecs);
         if (global_opts.debug_level > 1) {
           time_t t = wpt->GetCreationTime().toTime_t();
index c8737207fd4eb9fcfb3f96fa16d5f69c7c8b0028..96c470dcac0a2eb1d068aed9121334d2f0adfe52 100644 (file)
@@ -534,7 +534,7 @@ gtm_read(void)
       wpt->icon_descr = icon_descr[icon];
     }
     fread_discard(file_in, 1);
-    wpt->creation_time = fread_long(file_in);
+    wpt->SetCreationTime(fread_long(file_in));
     if (wpt->creation_time.isValid()) {
       wpt->creation_time += EPOCH89DIFF;
     }
index d6ed2ffdf22efdc927aec0cec87622ee36dedad7..a3abd5455eb4e5b31b737155b9b5008e591aba24 100644 (file)
@@ -229,8 +229,8 @@ gtc_write_xml(int indent, const char* fmt, ...)
 static void
 gtc_lap_start(const route_head* rte)
 {
-  gtc_least_time = 0;
-  gtc_most_time = 0;
+  gtc_least_time = gpsbabel::DateTime();
+  gtc_most_time = gpsbabel::DateTime();
 }
 
 static void
index 4de57a4d4effe00f5da01ff9462a9b1c2cfd8c71..7b7d0d83b99a5e67d108689a40ad059fab45164b 100644 (file)
@@ -165,7 +165,7 @@ static void igo8_read(void)
 
     wpt_tmp->latitude = le_read32(&point.lat) / (double)0x800000;
     wpt_tmp->longitude = le_read32(&point.lon) / (double)0x800000;
-    wpt_tmp->creation_time = le_read32(&point.unix_time);
+    wpt_tmp->SetCreationTime(le_read32(&point.unix_time));
 
     track_add_wpt(track_head, wpt_tmp);
   }
index caf380905d3328d932dfcd147e187a9539569b0f..ce02ebeac29e772a4e4d3cfe4c33a04a8db12671 100644 (file)
@@ -98,7 +98,7 @@ interpfilt_process(void)
                timen < wpt->creation_time.toTime_t();
                timen += interval) {
             waypoint* wpt_new = waypt_dupe(wpt);
-            wpt_new->creation_time = timen;
+            wpt_new->SetCreationTime(timen);
             if (wpt_new->shortname) {
               xfree(wpt_new->shortname);
             }
@@ -130,8 +130,8 @@ interpfilt_process(void)
                  distn < curdist;
                  distn += dist) {
               waypoint* wpt_new = waypt_dupe(wpt);
-              wpt_new->creation_time = distn/curdist*
-                                       (wpt->creation_time.toTime_t() - time1) + time1;
+              wpt_new->SetCreationTime(distn/curdist*
+                                       (wpt->creation_time.toTime_t() - time1) + time1);
               if (wpt_new->shortname) {
                 xfree(wpt_new->shortname);
               }
index f5bd46111c46ccad6d94727d21c944d3e053fff8..c06469610575e9a105df683efe70644f1d91c698 100644 (file)
@@ -295,7 +295,7 @@ to_waypoint(itracku_data_record* d)
   wp = waypt_new();
   wp->longitude = deg_min_to_deg(le_read32(d->longitude));
   wp->latitude = deg_min_to_deg(le_read32(d->latitude));
-  wp->creation_time = decode_itracku_time(le_read32(d->creation_time));
+  wp->SetCreationTime(decode_itracku_time(le_read32(d->creation_time)));
   wp->speed = KNOTS_TO_MPS((float)d->speed);
   wp->wpt_flags.speed = 1;
   wp->altitude = le_read16(d->altitude);
index 2c3bc644a87f21adea394c2428af14f0ef4678a0..70eca57804c56e5684fd82de71627bd60f72b620 100644 (file)
@@ -692,11 +692,11 @@ void kml_output_trkdescription(const route_head* header, computed_trkdata* td)
   }
   if (td->start && td->end) {
     gpsbabel::DateTime t;
-    t = td->start;
+    t = QDateTime::fromTime_t(td->start);
     if (t.isValid()) {
       kml_td(hwriter, "Start Time", t.toPrettyString());
     }
-    t = td->end;
+    t = QDateTime::fromTime_t(td->end);
     if (t.isValid()) {
       kml_td(hwriter, "End Time", t.toPrettyString());
     }
@@ -715,9 +715,9 @@ void kml_output_trkdescription(const route_head* header, computed_trkdata* td)
     writer->writeStartElement("TimeSpan");
 
     gpsbabel::DateTime t;
-    t = td->start;
+    t = QDateTime::fromTime_t(td->start);
     writer->writeTextElement("begin", t.toPrettyString());
-    t = td->end;
+    t = QDateTime::fromTime_t(td->end);
     writer->writeTextElement("end", t.toPrettyString());
 
     writer->writeEndElement(); // Close TimeSpan tag
index c66f147202b654ec20c02222985c26203d93481b..aae47061d0d0f6ccd6177e3f58524613c6e0e8c2 100644 (file)
@@ -410,7 +410,7 @@ lowranceusr_parse_waypt(waypoint* wpt_tmp)
   /* Time is number of seconds since Jan. 1, 2000 */
   waypt_time = gbfgetint32(file_in);
   if (waypt_time) {
-    wpt_tmp->creation_time = base_time_secs + waypt_time;
+    wpt_tmp->SetCreationTime(base_time_secs + waypt_time);
   }
 
   if (global_opts.debug_level >= 2) {
index be54d10aa5c0479124860bdd121505f0cc64f32e..9fbdda48581dda9125ac70c4adaba0b5d4711602 100644 (file)
@@ -774,7 +774,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm)
   if (bmask & (1<<HEIGHT)) {
     trk->altitude       = itm->height;
   }
-  trk->creation_time  = itm->timestamp; // in UTC..
+  trk->SetCreationTime(itm->timestamp); // in UTC..
   if (bmask & (1<<MILLISECOND)) {
     trk->creation_time = trk->creation_time.addMSecs(itm->timestamp_ms);
   }
index a48ea91937a88175def7f67621fecf8fc2501314..91438008f793aa40c4a9b086d5239932b219b972 100644 (file)
@@ -240,7 +240,7 @@ data_read(void)
     wpt_tmp->description = xstrdup(desc);
     wpt_tmp->longitude = lon;
     wpt_tmp->latitude = lat;
-    wpt_tmp->creation_time = mktime(&tm);
+    wpt_tmp->SetCreationTime(mktime(&tm));
 
     waypt_add(wpt_tmp);
   }
index 3954bf14da5a8ae995f0fe15d0142cf7f15ecff4..61523057a92354d55725c13ad2515305547d4bde 100644 (file)
@@ -159,7 +159,7 @@ random_read(void)
       WAYPT_SET(wpt, depth, rand_int(10000) / 10.0);
     }
 
-    wpt->creation_time = time;
+    wpt->SetCreationTime(time);
     if RND(3) {
       wpt->creation_time.addMSecs(rand_int(1000) * 1000);
     }
index b0e24eb9e618705ecb9cbce611f430cf8d1bfd3a..2ffd7c052ad47e2338ec27ae396de9209476584d 100644 (file)
@@ -45,11 +45,7 @@ public:
   DateTime(QDate date, QTime time) : QDateTime(date, time) {}
   DateTime(QDateTime dt) : QDateTime(dt) {}
 
-  const time_t& operator=(const time_t& t) {
-    setTime_t(t);
-    return t;
-  }
-
+  // TODO: this should go away in favor of .addSecs().
   time_t operator+=(const time_t& t) {
     setTime_t(toTime_t() + t);
     return toTime_t();
index 779e44e6c385d7906616a64ba692eda4a1bbd98e..976bf75de6a76bc3faddf6059bfb5ce057dc8a6b 100644 (file)
@@ -460,7 +460,7 @@ unicsv_parse_status(const char *str)
 #endif
 
 #ifdef UNICSV_GC_READY
-static time_t
+static QDateTime
 unicsv_adjust_time(const time_t time, time_t *date)
 {
   time_t res = time;
@@ -473,7 +473,7 @@ unicsv_adjust_time(const time_t time, time_t *date)
     struct tm tm = *gmtime(&res);
     res = mklocaltime(&tm);
   }
-  return res;
+  return QDateTime::fromTime_t(res);
 }
 #endif